<%-- 
    Document   : index
    Created on : 22-oct-2013, 11:14:46
    Author     : jorge.correa
--%>
<%@page import="Conexion.GestionSQL"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    String strUsuario = null;
    String strEsAdmin = "N";
    String[] strDatos= null; 
    String[] strNombreUsuario = null;
    String[] strAdmin = null;
    String strSQL = "";
    strUsuario = (String) request.getParameter("txtCedula");
   
    if (strUsuario != null){    
        strSQL = "select p.txtNombre from tbl_personas p where  p.txtIdentificacion = '" + strUsuario + "'";
        strNombreUsuario = GestionSQL.getFila(strSQL);
        
        strSQL = "select rxp.txtIdPersona from tbl_roles_x_persona rxp where rxp.txtIdRol = 'ADM' and rxp.txtIdPersona = '" + strUsuario + "'";                  
        strAdmin = GestionSQL.getFila(strSQL);
        
        strSQL = "SELECT r.txtIdPersona from tbl_roles_x_persona r where r.txtIdPersona = '" + strUsuario + "' and r.txtIdRol = 'ADM' GROUP BY r.txtIdPersona";         
         strAdmin = GestionSQL.getFila(strSQL);
         
         if (strAdmin == null){
             strEsAdmin = "N";
         }else{
             strEsAdmin = "S";
         }
    }
       
    strSQL = "select g.txtTitulo, g.txtMensajeIni from tbl_generales g where g.txtForm = 'frmGeneral'";                  
    strDatos = GestionSQL.getFila(strSQL);
    session.setAttribute("txtEsAdmin", strEsAdmin);

%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="SHORTCUT ICON" href="Images/App.ico" />
        <link rel="stylesheet" type="text/css" href="Styles/menu.css" />
        <link rel="stylesheet" type="text/css" href="Styles/visualizacion.css" />
        <link rel="stylesheet" type="text/css" href="Styles/calendar-system.css" />
         <script type="text/javascript" src="Scripts/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" charset="UTF-8" src="Scripts/ajax.js"></script>         
        <script language="JavaScript" type="text/javascript" src="Scripts/JSCalendar.js"></script>
        <script language="JavaScript" type="text/javascript" src="Scripts/JSCalendar-es.js"></script>
        <script language="JavaScript" type="text/javascript" src="Scripts/JSCalendar-setup.js"></script>        
        <script type="text/javascript" charset="UTF-8" src="Scripts/comunes.js"></script>
        <script type="text/javascript" charset="UTF-8" src="Scripts/index.js"></script>          
        <script type="text/javascript" charset="UTF-8" src="Scripts/visualizacion.js"></script>
        <script type="text/javascript" charset="UTF-8" src="Scripts/indicador.js"></script>
        <title>Sistema de Consulta a la Plataforma SIU - Menú principal</title>
        <script type="text/javascript">
            function disableKeyPress(evt){               
                var evt = (evt) ? evt : ((event) ? event : null); 
                var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); 
                if ((evt.keyCode == 13) && (node.type=="text"))  {return false;} 
            }
        </script>
    </head>
    <body>
        <input type="hidden" name="txtUsuario" id="txtUsuario" value="<%=strUsuario%>">
        <header>
            <jsp:include page="header.jsp" />  
       </header>
        <br>
        <table cellspacing="0" cellpadding="0" border="0" class="TABLAACCIONES">
            <tr>
                <%if (strNombreUsuario != null){%>
                    <td class="USERLOGED" style="width: 85%;padding-left: 50px;">Bienvenido(a),&nbsp;<span style="font-weight: normal;"><%=strNombreUsuario[0]%></span></td>      
                <%}else{%>
                    <td class="USERLOGED" style="width: 85%;padding-left: 50px;">Bienvenido(a)!</td>      
                    <td class="CELDAACCION"><input type="button" value="Iniciar sesión" class="BOTONACCION" onclick="location.href='login.jsp';" /></td>
                <%}%>                
                <td class="CELDAACCION" style="border-left: 1px solid #116043"><input type="button" value="Salir" class="BOTONACCION" onclick="location.href='cerrar.jsp';" /></td>
            </tr>
        </table>
        <br>
        <nav>
                <table cellspacing="0" cellpadding="0" border="0" class="TABLANAVEGACION">
                    <tr>
                        <td class="CELDAMENU">
                            <div id="dMenu" align="right">
                                <table cellspacing="0" cellpadding="5" border="0" class="TABLAMENU">
                                    <tr><td class="TITULOMENU">MENÚ PRINCIPAL</td></tr>
                                    <tr><td class="SUBTITULOMENU">Creación de solicitud</td></tr>
                                    <tr><td class="ITEMMENU"><a href="#" onclick="javascript:window.open('solicitud.jsp?txtAccion=C','Solicitud','top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes')">Crear solicitud</a></td></tr>
                                    <tr><td class="SUBTITULOMENU">Consulta de solicitudes</td></tr>    
                                    <%if (strNombreUsuario == null){%>
                                    <tr><td class="ITEMMENU" id="itVerSolicitud"><a href="#">Ver estado de solicitud</a></td></tr>
                                     <%}else{%>
                                        <tr><td class="ITEMMENU" id="itMSolicitudes">Mis solicitudes</td></tr>
                                    <%}%>
                                    <%if(strEsAdmin.equals("S")){%>
                                        <tr><td class="SUBTITULOMENU">Indicadores</td></tr>
                                        <tr><td class="ITEMMENU" id="itNumSolUsuario"><a href="#">Número de solicitudes por tipo de usuario</a></td></tr>
                                        <tr><td class="ITEMMENU" id="itTopServicios"><a href="#">Top de servicios más solicitados</a></td></tr>                                    
                                        <tr><td class="SUBTITULOMENU">Administración</td></tr>
                                        <tr><td class="ITEMMENU"><a href="#" onclick="javascript:window.open('admin.jsp','Administracion','top=0,left=0,width='+(screen.availWidth)+',height ='+(screen.availHeight)+',toolbar=0 ,location=0,directories=0,status=0,menubar=0,resizable=1,scrolling=1,scrollbars=yes')">Parámetros del sistema</a></td></tr>
                                    <%}%>
                                </table>
                            </div>
                        </td>
                        <td class="CELDAESPACIO"></td>
                        <td class="CELDAMOSTRAR">
                            <div id="dMostrar" style="display: none;">
                                <%if(strDatos != null){%>
                                    <table cellspacing="0" cellpadding="5" border="0" class="TABLAMSGINI">
                                        <tr>
                                            <td class="CELDATITULOMSGINI"><%=strDatos[0]%></td>
                                        </tr>
                                        <tr><td style="height: 20px;"></td></tr>
                                        <tr>
                                            <td class="CELDATEXTOMSGINI"><%=strDatos[1]%></td>
                                        </tr>
                                    </table>
                                <%}%>
                            </div>
                        </td>
                    </tr>
                </table>  
        </nav>
        <br>
        <footer>
            <div id="dFooter" class="FOOTER">
                <jsp:include page="footer.jsp" />          
            </div>
       </footer>        
    </body>
</html>
